package ganga.custodian.plot;

/***********************************
 * @author Aksenov 14\06 in train
 */
import java.util.Vector;

import com.androidplot.series.XYSeries;

public class KIGSeries implements XYSeries { 
	private Vector<Double> kigData;
	private String labelString;
	
	public void setLabel(String Label){
		labelString = Label;
	}

	public KIGSeries(Vector<Double> data){
		update(data);
	}
	public void update(Vector<Double> data){
		this.kigData=data;
	}
	
    public Number getX(int index) {
    	if(index==0) return(index);
    	int newindex=index;
    	double simpleMemoryPoint=0;	
    	for(int i =0;i<newindex;i++) simpleMemoryPoint=simpleMemoryPoint+kigData.get(i);
    return(simpleMemoryPoint); 	
    	
    	
    }
    
    
   
    
    public double getMinY() {
    	double min=kigData.get(0);
    	for(int i=1;i<kigData.size();i++){
    		if(kigData.get(i)<min)
    			min=kigData.get(i);
    	}
    	return(min);    	
    }
    
    public double getMaxX() {
    	double max=0;	
    	for(int i =0;i<kigData.size()-1;i++) max=max+kigData.get(i);
    return(max);    	
    }
    

    
    
    public double getMaxY() {
    	double max=kigData.get(0);
    	for(int i=1;i<kigData.size();i++){
    		if(kigData.get(i)>max)
    			max=kigData.get(i);
    	}
    	return(max);    	
    }
   
    
    public String getTitle() {
        return (labelString);
    }
 
    
    public int size() {
        return kigData.size();
    }
 
    
    public Number getY(int index) {
    	       return kigData.get(index);
    }
  }